//
//  ReheatTableViewCell.m
//  一点互助
//
//  Created by rimi on 16/9/5.
//  Copyright © 2016年 zhangboqiu. All rights reserved.
//

#import "ReheatTableViewCell.h"
#import <SDWebImage/UIImageView+WebCache.h>

@implementation ReheatTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(void)layoutSubviews{
    [super layoutSubviews];
    self.image.layer.cornerRadius = self.image.bounds.size.height/2;
    self.image.layer.masksToBounds = YES;
}
-(void)setModel:(WishesModel *)model{
    _model = model;
    NSString *str = [NSString stringWithFormat:@"http://www.scxxhs.com/huzhu/%@",model.avatar];
    NSURL *url = [NSURL URLWithString:str];
    [self.image sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"好友-头像9"]];
    self.titleLabel.text = model.title;
    NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
    [formatter setDateStyle:NSDateFormatterMediumStyle];
    [formatter setTimeStyle:NSDateFormatterShortStyle];
    [formatter setDateFormat:@"yyyy-MM-dd"];
    NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];
    [formatter setTimeZone:timeZone];
    NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:[model.wishAddTime integerValue]];
    NSString *confromTimespStr = [formatter stringFromDate:confromTimesp];
    self.timeLabel.text = [NSString stringWithFormat:@"上线时间 %@",confromTimespStr];
    self.numLabel.text = [NSString stringWithFormat:@"%ld",(long)model.wishRewardNum];
    self.detailLabel.text = [NSString stringWithFormat:@"%@",model.wishDesc];
    self.nameLabel.text = model.userNiceName;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
